<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登陆--首页</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script type="text/javascript" src="libs/handlebars.min.js"></script>
<script src="libs/jquery-1.12.1.min.js"></script>
<script src="libs/getQueryString.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<link href="libs/dropzone.css" rel="stylesheet" />
<script src="libs/dropzone.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>
					<strong>小超记账</strong>
				</h2>
			</div>
		</div>
	</div>

	<div class="container">
		<div class="row">
			<div class="col-md-8">
				<ul class="nav nav-pills pull-right">
					<li role="presentation" class="active"><a href="index.html">首页</a></li>

					<li role="presentation"><a href="adda.html">添加档案</a></li>
					<li role="presentation"><a href="query.html">统计</a></li>
					<li role="presentation"><a href="select.html">查询</a></li>
					<li><a href="#">用户：<span id="text3"></span></a></li>
				</ul>
				<div class="col-md-12">
					<button id="query_null">退出</button>
								</div>
							</div>
						</div>
							<div class="container">
<!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">1</a></li>
    <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">2</a></li>
    <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">3</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="home"><div class="panel-body" id="list1"><div>
					  <table border="2" style="text-align:center;">
					   <tr><td>ID</td><td><input id="id" readonly="readonly"></td></tr>
					   <tr><td>檔案號</td><td><input id="archive_id" readonly="readonly"></td></tr>
					   <tr><td>身份证号</td><td><input id="identity"></td></tr>
					   <tr><td>姓名</td><td><input id="name"></td></tr>
					   <tr><td>性别</td><td><input id="gender"></td></tr>
					   <tr><td>出生日期</td><td><input id="birthday"></td></tr>
					   <tr><td>预退休日期</td><td><input id="date_retire1"></td></tr>
					   <tr><td>实际退休日期</td><td><input id="date_retire2"></td></tr>
					   <tr><td>特殊工种</td><td><input id="sp"></td></tr>
					   <tr><td>女管理岗位</td><td><input id="fc"></td></tr>
					   <tr><td>职称</td><td><input id="title"></td></tr>
					   <tr><td>工龄</td><td><input id="seniority"></td></tr>
					   <tr><td><input type="button" id="query_update" value="修改"></td></tr>
					     <tr><td><input type="button" id="query_del" value="删除"></td></tr>
					 </table>
					 
					</div></div></div>
    <div role="tabpanel" class="tab-pane" id="profile">
    <div class="panel-body" id="list2">
    </div>
   
			
    </div>
     <div role="tabpanel" class="tab-pane" id="messages">
   </div><form id="dropzone" action="" class="dropzone" method="post"></form>
</div>


<script type="text/javascript">
var id = getQueryString('id');
	Dropzone.options.dropzone = {
	  url: id + '/upload.action',
    clickable: true,
    acceptedFiles: '.jpg',
    dictDefaultMessage: '拖放图片文件到此位置',
    dictInvalidFileType: '错误的文件类型',
    dictFileTooBig: '文件过大',
    dictResponseError: '与服务器连接失败',
    dictCancelUpload: '已取消',
    dictCanceluploadConfirmation: '确认取消上传'
  }
  </script>




				
<script type="text/javascript">
	$(function() {
		var id = getQueryString('id');
		   $('#form').attr('action',id+'/upload.action');
		var id = getQueryString('id');
		var url = 'queryone.action?id=' + id;
		$.getJSON(url, function(res) {
			console.log(res);
			$('#id').val(res.id);
			$('#archive_id').val(res.archive_id);
			$('#identity').val(res.identity);
			$('#name').val(res.name);
			$('#gender').val(res.gender);
			$('#birthday').val(res.birthday);
			$('#date_retire1').val(res.date_retire1);
			$('#date_retire2').val(res.date_retire2);
			$('#sp').val(res.sp);
			$('#fc').val(res.fc);
			$('#title').val(res.title);
			$('#seniority').val(res.seniority);
			/* var date = {
				'item' : res
			};
			var t = Handlebars.compile($('#template').html());
			$('#list1').html(t(date)); */
		})
				$.getJSON('query_photo.action?id=' + id, function(res) {
				console.log(res);
				var data ={
					'item':res
				};
				var t = Handlebars.compile($('#template').html());
				$('#list2').html(t(data));
			});
		$('#query_del').click(function(){
		$.post(
				'query_del.action',
				{
					id : id
				},
				function(
						res,
						status) {
					window.location.href = "select.html";
				})
})
			$('#query_update').click(function(){
				$.post('query_update.action?id='+id,{
					//id:$('#id').val(),
					archive_id:$('#archive_id').val(),
					identity:$('#identity').val(),
					name:$('#name').val(),
					gender:$('#gender').val(),
					birthday:$('#birthday').val(),
					date_retire1:$('#date_retire1').val(),
					date_retire2:$('#date_retire2').val(),
					sp:$('#sp').val(),
					fc:$('#fc').val(),
					title:$('#title').val(),
					seniority:$('#seniority').val()
				},function(res,status){
					if("OK"==res){alert('修改成功');}
			})
		})
		
	})
</script>
<script type="text/javascript">
$('#myTabs a').click(function (e) {
	   e.preventDefault()
	   $(this).tab('show')
	 })
</script>
	<script id="template" type="text/x-handlebars-template">
    {{#each item}}
 	 <div class="panel panel-default col-md-4" >
   	  <div class="panel-body">
       <dl>
		 <p>

	<a href="query_del.html?id={{id}}">	<img src="upload/{{archive_id}}/{{name}}" width="200" height="200" /></a>

 
		 </p>
		
	   </dl>  
      </div>
   	 </div>
 	{{/each}}
	</script>



</body>
</html>